package com.example.appinstalldemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.example.appinstalldemo.utils.ToolUtils;

import java.util.Arrays;

public class MainActivity extends AppCompatActivity {
    String [] mPackage ={"com.example.livedatautilsdemo","com.example.roomdemo"};
    private TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
    }

    private void initView() {
        textView = findViewById(R.id.tv_test);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              //  ToolUtils.uninstall(MainActivity.this, "com.example.roomdemo");
                ToolUtils.openApp("com.example.livedatautilsdemo",MainActivity.this);
            }
        });
    }

    private void initData() {
        String threadPackageName = ToolUtils.getForegroundAppPackageName(this);
    }
}